package com.shw.loco.adapter;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Vector;

import com.shw.loco.vo.ComPortInfo;
import com.shw.loco.vo.GPSBDInfo;
import com.shw.loco.vo.RFIDBoardInfo;
import com.shw.loco.vo.WorkingInfo;

/**
 * 
 * @author HAHA
 * 
 */
public class LocoInfoQueue {

	private static Vector<ComPortInfo> comQueueList = new Vector<ComPortInfo>();
	private static Vector<WorkingInfo> workQueueList = new Vector<WorkingInfo>();
	private static Vector<RFIDBoardInfo> rfidVector = new Vector<RFIDBoardInfo>();// rfid的数据
	public static Vector<GPSBDInfo> gpsbdVector = new Vector<GPSBDInfo>();// gpsbd的数据
	public static Vector<String> locoQueVecotr = new Vector<String>();// 请求转发
	public static Vector<String> locoRFIDQueVecotr = new Vector<String>();// 机车请求RFID
	public static Vector<byte[]> locoErrorQueVecotr = new Vector<byte[]>();// 主控板返回错误信息给机车
	public static Vector<String> locoErrorQue = new Vector<String>();// 主控板返回错误信息给机车的请求
	public static Vector<byte[]> centerToLocoList = new Vector<byte[]>();// 转发信息
	public static Vector<byte[]> resultToLocoVector = new Vector<byte[]>();// 计算后的数据给Loco
	public static Vector<byte[]> resultToCenterVector = new Vector<byte[]>();// 计算后的数据给center
	public static Vector<String> sourceInfo=new Vector<String>();//原始数据

	public static synchronized void addComQueue(ComPortInfo ComData) {
		comQueueList.add(ComData);
	}

	public static synchronized ComPortInfo getComQueue() {
		if (comQueueList.size() > 0)
			return comQueueList.remove(comQueueList.size()-1);
		else
			return null;
	}

	public static synchronized void addWorkQueue(WorkingInfo workingInfo) {
		workQueueList.add(workingInfo);
	}

	public static synchronized WorkingInfo getWorkQueue() {
		return workQueueList.remove(workQueueList.size()-1);
	}

	public static synchronized byte[] getLocoQueue() {
		return centerToLocoList.remove(centerToLocoList.size()-1);
	}

	public static synchronized void addLocoQueue(byte[] locoInfo) {
		centerToLocoList.add(locoInfo);
	}

	public static void addRFIDV(RFIDBoardInfo boardInfo) {
		rfidVector.add(boardInfo);
	}

	public static void addGPBDV(GPSBDInfo gpsbdInfo) {
		gpsbdVector.add(gpsbdInfo);
	}

	public static RFIDBoardInfo getRFIDBoardInfo() {
		if (rfidVector.size() > 0)
			return rfidVector.remove(rfidVector.size()-1);
		else
			return null;
	}

	public static GPSBDInfo getGPSBDInfo() {
		if (gpsbdVector.size() > 0)
			return gpsbdVector.remove(0);
		else
			return null;
	}
}
